package cn.zurish.cloud.kafka.mq;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;

//@Component
public class MyBean {

    private final KafkaTemplate<String, String> kafkaTemplate;
    private final StandardServletMultipartResolver standardServletMultipartResolver;

    public MyBean(KafkaTemplate<String, String> kafkaTemplate, StandardServletMultipartResolver standardServletMultipartResolver) {
        this.kafkaTemplate = kafkaTemplate;
        this.standardServletMultipartResolver = standardServletMultipartResolver;
    }

    public void someMethod() {
        this.kafkaTemplate.send("someTopic", "Hello");
    }

    @KafkaListener(topics = "someTopic")
    public void processMessage(String content) {
        System.out.println(" content: " + content);
    }

}